import request from "@/utils/request";
import axios from "axios";

// 物料库存趋势图
export const getInChart = (data) => {
  return request({
    url: "/steel-arch/material/in/chart",
    method: "get",
    params: data,
  });
};
// 物料消耗趋势图
export const getOutChart = (data) => {
  return request({
    url: "/steel-arch/material/out/chart",
    method: "get",
    params: data,
  });
};
// 计划统计
export const getTotalTask = (data) => {
  return request({
    url: "/steel-arch/client/homepage/totalTask",
    method: "get",
    params: data,
  });
};
// 库存信息
export const getInventory = (data) => {
  return request({
    url: "/steel-arch/client/homepage/getInventory",
    method: "get",
    params: data,
  });
};
//产量走势
export const getTaskRecordByDay = (data) => {
  return request({
    url: "/steel-arch/client/homepage/getTaskRecordByDay",
    method: "get",
    params: data,
  });
};
// 产品参数
export const getProdList = (data) => {
  return request({
    url: "/steel-arch/client/homepage/getProdList",
    method: "get",
    params: data,
  });
};
// 产品参数
export const getProdList1 = (data) => {
  return request({
    url: "/steel-arch/client/prod/produceRecord",
    method: "get",
    params: data,
  });
};
// 产品记录
export const getByBatchCode = (data) => {
  return request({
    url: "/steel-arch/client/prod/record/getByBatchCode2",
    method: "get",
    params: data,
  });
};
// 运维记录
export const listDeviceV2MaintenanceRecords = (data) => {
  return request({
    url: "/steel-arch/client/homepage/listDeviceV2MaintenanceRecords",
    method: "get",
    params: data,
  });
};
// 报警记录
export const getWarnList = (data) => {
  return request({
    url: "/steel-arch/client/homepage/getWarnList",
    method: "get",
    params: data,
  });
};

// 入库记录
export const getInList = (data) => {
  return request({
    url: "/steel-arch/material/font/in/group",
    method: "get",
    params: data,
  });
};
// 入库记录
export const getInProdList = (data) => {
  return request({
    url: "/steel-arch/material/font/in/list",
    method: "get",
    params: data,
  });
};
// 检验记录
export const getCheckList = (data) => {
  return request({
    url: "/steel-arch/client/prod/record/check/list",
    method: "get",
    params: data,
  });
};

export const getFontList = (data) => {
  return request({
    url: "/steel-arch/gantry/font/gantry/list",
    method: "post",
    params: data,
  });
};

export const getFontRecordList = (data) => {
  return request({
    url: "/steel-arch/gantry/font/gantry/list",
    method: "get",
    params: data,
  });
};

export const getOptionNameList = (data) => {
  return request({
    url: "/steel-arch/gantry/option/name",
    method: "get",
    params: data,
  });
};

const params = {
  appKey: "ab40b916f86b4e4881cf777ad633d3f5",
  appSecret: "e7e534d46f3bbc766df8bb933bbcc15e",
};
// 新增获取token
export function getToken() {
  return axios({
    url: `https://open.ys7.com/api/lapp/token/get?appKey=${params.appKey}&appSecret=${params.appSecret}`,
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
//驾驶仓下发数据
export const sendData = (data) => {
  return request({
    url: "/steel-arch/client/homepage/device/sendData",
    method: "post",
    data: data,
  });
};

//驾驶仓启动
export const start = (data) => {
  return request({
    url: "/steel-arch/client/homepage/device/start",
    method: "post",
    data: data,
  });
};

//驾驶仓启动
export const stop = (data) => {
  return request({
    url: "/steel-arch/client/homepage/device/stop",
    method: "post",
    data: data,
  });
};

export const reset = (data) => {
  return request({
    url: "/steel-arch/client/homepage/device/rset",
    method: "post",
    data: data,
  });
};
//驾驶仓设备急停
export const suddenStop = (data) => {
  return request({
    url: "/steel-arch/client/homepage/suddenStop",
    method: "get",
    params: data,
  });
};

//ai统计
export const totalWarnByAI = (data) => {
  return request({
    url: "/steel-arch/client/homepage/totalWarnByAI",
    method: "get",
    params: data,
  });
};

//ai统计列表
export const listLastWarnByAI = (data) => {
  return request({
    url: "/steel-arch/client/homepage/listLastWarnByAI",
    method: "get",
    params: data,
  });
};

